#ifndef __FactionMap_h__
#define __FactionMap_h__

#pragma once


#include <IFactionMap.h>


class CFactionMap :
	public IFactionMap
{
public:
	enum
	{
		MaxFactionCount = 32,
	};

	CFactionMap();

	virtual uint32 GetFactionCount() const;
	virtual const char* GetFactionName(uint8 faction) const;
	virtual uint8 GetFactionID(const char* name) const;

	void Clear();
	void Reload();

	bool LoadConfig(const char* fileName);

	uint8 CreateFaction(const char* factionName);

	void SetReaction(uint8 factionOne, uint8 factionTwo, IFactionMap::EReactionType reaction);
	IFactionMap::EReactionType GetReaction(uint8 factionOne, uint8 factionTwo) const;

	void Serialize(TSerialize ser);

private:
	bool GetReactionType(const char* reactionName, EReactionType* reactionType) const;
	uint8 m_reactions[MaxFactionCount][MaxFactionCount];

	typedef stl::hash_map<uint8, string> FactionNames;
	FactionNames m_names;

	typedef stl::hash_map<string, uint8, stl::hash_stricmp<string> > FactionIds;
	FactionIds m_ids;

	typedef std::vector<string> FileNames;
	FileNames m_fileNames;
};

#endif